package com.dmbjz.rpc.service;


import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.service.annotation.GetExchange;
import reactor.core.publisher.Mono;

public interface WeatherInterface {

    //@GetExchange 指定URL，往哪里发送请求，accept 指定相应参数类型
    //@RequestParam 搭配 @GetExchange 使用时，相当于指定需要携带的参数，案例的实际请求时就是 http://请求地址/area-to-weather-date?area=city的值
    @GetExchange(url = "https://ali-weather.showapi.com/area-to-id", accept = MediaType.APPLICATION_JSON_VALUE)
    Mono<String> getWeather(
            @RequestParam("area") String city,
            @RequestHeader("Authorization") String authorization
    );

}
